home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1990-1992 by Michael Davidson.
- * All rights reserved.
- *
- * Permission to use, copy, modify, and distribute this software
- * and its documentation for any purpose and without fee is hereby
- * granted, provided that the above copyright notice appear in all
- * copies and that both that copyright notice and this permission
- * notice appear in supporting documentation.
- *
- * This software is provided "as is" without express or implied warranty.
- */
-
- /*
- * menu utilities
- */
- #include <stdio.h>
- #include "vg.h"
- #include "text.h"
- #include "kbd.h"
-
- extern void *alloca(int);
-
- menuBorders(
- int x,
- int y,
- int w,
- int h,
- char *title,
- char *labels
- )
- {
- int i;
- int fg;
- int bg;
- char *line = alloca(w);
-
- fg = 0x0B;
- bg = 0x01;
-
- memset(line, HORIZONTAL_LINE, w);
- line[0] = TOP_LEFT_CORNER;
- line[w-1] = TOP_RIGHT_CORNER;
- vidPutText(x, y, line, w, fg, bg);
-
- line[0] = BOT_LEFT_CORNER;
- line[w-1] = BOT_RIGHT_CORNER;
- vidPutText(x, y+h-1, line, w, fg, bg);
-
-
- memset(line, ' ', w);
- line[0] = VERTICAL_LINE;
- line[w-1] = VERTICAL_LINE;
- for (i = 1; i < h-1; i++)
- vidPutText(x, y+i, line, w, fg, bg);
-
- memset(line, HORIZONTAL_LINE, w);
- line[0] = LEFT_TEE;
- line[w-1] = RIGHT_TEE;
- vidPutText(x, y+2, line, w, fg, bg);
- vidPutText(x, y+h-3, line, w, fg, bg);
-
- sprintf(line, "ESC=Exit");
- i = strlen(line);
- vidPutText(x+2, y+1, line, strlen(line), fg, bg);
-
- i = strlen(title);
- if (i > 32)
- i = 32;
- vidPutText(x+ (w - i) / 2, y+ 1, title, i, fg, bg);
-
- sprintf(line, "ENTER=Show");
- i = strlen(line);
- vidPutText(x+(w-i)-2, y+1, line, strlen(line), fg, bg);
-
- i = strlen(labels);
- vidPutText(x+3, y+h-2, labels, i, fg, bg);
- }
-